<!DOCTYPE html>
<html>
<head>
    <title>志愿者登录</title>
    <meta name="keywords" content=""/>
    <meta name="description" content="">
    <include file="public@head_base"/>
    <link rel="stylesheet" href="__TMPL__/public/assets/css/volunteer.css">

</head>

<body class="body-white">
<div class="container shadow">
    <include file="public@nav"/>
    <div class="row">
        <div class="upload_form">
            <h2 class="text-center">志愿者登录</h2>
            <p class="tips">如何申请志愿者，请先申请注册。<a href="{:cmf_url('volunteer/register/index')}" style="color: #0055aa">立即注册</a></p>
           

            <form class="layui-form" style="width: 400px;margin: auto;margin-top: 24px;"
                  action="{:url('volunteer/Login/doLogin')}" method="post">

                <div class="layui-form-item">
                    <label class="layui-form-label">账号</label>
                    <div class="layui-input-block">
                        <input class="layui-input" type="text" name="username" lay-verify="required">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">密码</label>
                    <div class="layui-input-block">
                        <input class="layui-input" type="password" name="password" lay-verify="required">
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn layui-btn-normal" lay-submit lay-filter="formDemo">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<!-- /container -->

<include file="public@scripts"/>
</body>
<script>
    //Demo
    layui.use(['form', 'laydate', 'upload'], function () {
        var form = layui.form;
        var layer = layui.layer;
        //监听提交
        form.on('submit(formDemo)', function (data) {

            var index = layer.load(2);
            console.log(data);
            var fields=$(data.form).serialize();
            $.post("{:url('volunteer/login/doLogin')}", fields, function (res) {
                console.log(res);
                layer.close(index);
                layer.alert(res.msg, function (index) {
                    if (res.code == 1) {
                        window.location.href = res.url;
                    }
                    layer.close(index)
                });

            });
            return false;
        });
    });

</script>
</html>